home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d7 / lanserv.arc / TSRCOM26.ARC / TSR.DOC < prev    next >
Text File  |  1989-07-27  |  22KB  |  516 lines

  1. ****************************************************************
  2. *                TSR Utilities Version 2.6                     *
  3. *   The TSR Utilities include programs useful in managing      *
  4. *   DOS memory, and in particular managing memory-resident     *
  5. *  utilities. TSR stands for "Terminate and Stay Resident".    *
  6. *                                                              *
  7. ****************************************************************
  8.  
  9. A. Introduction
  10. ================================================================
  11.  
  12. The TSR Utilities have grown to include 8 programs. Here's a
  13. quick overview of each one:
  14.  
  15.   MARK - marks a position above which TSRs can be released.
  16.   RELEASE - removes TSRs from memory.
  17.   FMARK - performs the same function as MARK but uses less memory.
  18.   MAPMEM - shows what memory resident programs are loaded.
  19.   WATCH - a TSR itself, it keeps detailed records of other TSRs.
  20.   DISABLE - disables or reactivates TSRs kept in memory.
  21.   RAMFREE - shows how much RAM memory is available.
  22.   EATMEM - uses up memory for controlled program testing.
  23.  
  24. The programs are described in more detail in the following
  25. sections.
  26.  
  27.  
  28. B. MARK, FMARK and RELEASE
  29. ================================================================
  30.  
  31. MARK.COM and RELEASE.EXE are used to remove memory-resident
  32. programs from memory, without requiring a system reboot, and
  33. without the usual problems of creating holes or leaving
  34. interrupts dangling. The two programs are used simply as follows:
  35.  
  36. 1) Run the program MARK.COM before installing any memory-
  37.    resident program that you may wish to deinstall later.
  38.    This marks the current position in memory and stores the
  39.    DOS interrupt vector table (all interrupts from 0 to FFH).
  40.  
  41. 2) Install whatever TSRs that you want to use, in the normal
  42.    way that you install them.
  43.  
  44. 3) When you want to deinstall all TSRs above the last MARK,
  45.    run the program RELEASE.EXE. This will release all of the
  46.    memory above (and including) the last MARK, and restore
  47.    all interrupt vectors taken over by the memory resident
  48.    programs.
  49.  
  50. MARK and RELEASE can be "stacked" as many times as desired.
  51. RELEASE releases the memory above the last MARK call. MARK uses
  52. about 1600 bytes of memory each time it is called. This 1600
  53. byte region is also released when a RELEASE is done. MARK memory
  54. usage is dominated by the copies of the DOS interrupt vector
  55. table (interrupts 0..FFh) and the copy of the EMS page map
  56. (blocks 0..31 only) which MARK keeps when it goes resident.
  57.  
  58. ----------------------------------------------------------------
  59.  
  60. MARK and RELEASE can optionally be called with a single command
  61. line parameter:
  62.  
  63.   MARK MarkName
  64.   RELEASE MarkName
  65.  
  66. In this way a particular mark is given a name. Calling RELEASE
  67. with the same name will release all memory above and including
  68. the mark of that name, also releasing any intermediate marks in
  69. the process. If no mark of the proper name is found, RELEASE
  70. will halt with a warning. A RELEASE call with no MarkName
  71. specified will release the last MARK, whether or not that MARK
  72. was named.
  73.  
  74. The MarkName can be any text string up to 126 characters in
  75. length. It may not contain embedded blanks or tabs. Case (upper
  76. or lower) is not important when matching MarkNames.
  77.  
  78. MarkName supports an additional feature. If the MarkName begins
  79. with ! (exclamation point), then the mark is called a "protected
  80. mark". That mark can be released *only* by an exact match to its
  81. name (including the exclamation point). A protected mark will
  82. NOT be released with an "unnamed" RELEASE. Any named or unnamed
  83. RELEASE will stop without releasing any memory if it encounters
  84. a protected mark that it does not match exactly.
  85.  
  86. ----------------------------------------------------------------
  87.  
  88. As of version 1.4, MARK and RELEASE also control Expanded memory
  89. (Lotus/Intel/Microsoft EMS). They have been tested with READY!
  90. and with the TurboPower Software expanded memory disk cache, as
  91. well as with the device drivers used by the STB Expanded Memory
  92. Card.
  93.  
  94. WARNING: if a resident application allocates expanded memory at
  95. some time *after* going resident and after the last MARK made,
  96. that expanded memory will be released by a call to RELEASE. The
  97. most common expanded memory manager (EMM 3.2) does not give us
  98. enough information to avoid this possibility. Fortunately, there
  99. are no known memory resident programs which perform this dynamic
  100. allocation of expanded memory.
  101.  
  102. ----------------------------------------------------------------
  103.  
  104. As of version 1.6, RELEASE takes special precautions to allow it
  105. to release extra invocations of the DOS command processor. In
  106. the simplest form, an extra command processor is obtained by
  107. typing COMMAND at the DOS level. Many multitasking or switching
  108. utilities also utilize this feature of DOS, and these utilities
  109. can now be managed via MARK and RELEASE.
  110.  
  111. ----------------------------------------------------------------
  112.  
  113. Due to the way DOS handles batch files, there are certain
  114. limitations on using RELEASE within batch. You *cannot* perform
  115. the following sequence of events successfully:
  116.  
  117. First, from the DOS command line:
  118.  
  119.   MARK
  120.   SK      {SideKick, or any other resident program or programs}
  121.  
  122. Then, within a batch file:
  123.  
  124.   RELEASE {get rid of SK and MARK}
  125.   LOTUS   {run Lotus using the additional memory}
  126.   MARK    {put SK back in place}
  127.   SK
  128.  
  129. DOS allocates a small memory block prior to running any batch
  130. file. It does not allow that block to be deallocated from within
  131. the batch file without various errors occurring. As a result, in
  132. this case the MARK and SK memory blocks are effectively trapped
  133. until the batch file is completed, after which the memory will
  134. be reusable. Indeed, if you run the batch file presented above,
  135. you will get MARK and SK installed above a big hole in memory
  136. left by the previous images of MARK and SK.
  137.  
  138. As of version 1.9, RELEASE guards against this possibility. If
  139. it senses that you are attempting to release memory trapped by a
  140. "batch control block", it writes a warning message to that
  141. effect. It still releases the memory, but when it exits it
  142. passes back a return code of 1 rather than the usual value of 0.
  143.  
  144. You *can* obtain the desired effect in at least two other ways.
  145. First, you could make two batch files and call them one after the
  146. other:
  147.  
  148. Batch file #1:
  149.   RELEASE
  150.  
  151. Batch file #2:
  152.   LOTUS
  153.   MARK
  154.   SK
  155.  
  156. In this case, running RELEASE in batch file #1 has the same
  157. effect as running RELEASE from the DOS command line. However,
  158. directly calling the second batch file from the first doesn't
  159. always seem to work either. The only sure bet appears to be the
  160. use of a keypoker like STACKEY, KEY-FAKE or PCED's KEYIN,
  161. modifying Batch #1 as follows:
  162.  
  163.   RELEASE
  164.   KEY-FAKE "batch2" 13
  165.  
  166. A better way to make these things happen is to use the public
  167. domain program CED, or its commercial upgrade PCED. These
  168. programs allow you to define "synonyms" for groups of commands.
  169. The commands execute one after the other just like a batch file.
  170. However, the synonyms do not create an extra batch control
  171. memory block which causes the problems just described.
  172.  
  173. Thus you could make two CED synonyms as follows. (We assume that
  174. the CED "chain character" is ^).
  175.  
  176. SYN LOADSK 'mark !sk^sk'
  177.   {create a protected sidekick marker and load sidekick}
  178.  
  179. SYN RUNLOT 'release !sk^lotus^mark !sk^sk'
  180.   {release sidekick if it's there, run lotus, then reload sidekick}
  181.  
  182. Note: you can obtain PCED by calling Cove Software at
  183. 301-992-9371.
  184.  
  185. ----------------------------------------------------------------
  186.  
  187. Regarding PCED, please note the following: PCED supports
  188. "user-installed commands" such as KEYIN, HS, RAW and others. MARK
  189. and RELEASE are unable to release these user-installed commands
  190. individually. That is, if your AUTOEXEC.BAT looked like the
  191. following:
  192.  
  193.   CED
  194.   MARK
  195.   KEYINST
  196.  
  197. then typing RELEASE would sooner or later cause your system to
  198. crash. RELEASE cannot inform PCED that its installed command is
  199. gone, and PCED will continue to try to use code which is no
  200. longer in memory.
  201.  
  202. PCED itself provides a "KILL" command which removes
  203. specified user-installed programs from memory. Use the KILL
  204. command if you want to remove PCED's user-installed commands from
  205. memory.
  206.  
  207. MARK and RELEASE can safely be used with PCED's commands as long
  208. as PCED itself is removed from memory when the commands are.
  209.  
  210. ----------------------------------------------------------------
  211.  
  212. As of version 2.0, a new form of marking, called a "file
  213. mark", is also supported. The new mark has the advantage that it
  214. uses only about 150 bytes of memory rather than the 1600 of MARK.
  215.  
  216. The new mark is placed with the command
  217.  
  218.     FMARK [d:][directory]filename
  219.  
  220. The bulk of the vector table and EMS page map are stored in the
  221. file which you specify on the command line rather than in
  222. memory. Note that a command line parameter is *required* in this
  223. case. Otherwise FMARK will halt with an error. The file created
  224. by FMARK will be between 1000 and 2000 bytes in size, depending
  225. on usage of expanded memory.
  226.  
  227. If you will switch drives or directories after using FMARK, you
  228. should specify a complete pathname when FMARK is initially
  229. called. To avoid confusion, you may want to keep the FMARK files
  230. in the root directory, or in a separate directory defined just
  231. for this purpose.
  232.  
  233. The RELEASE program can release either an in-memory mark (placed
  234. by MARK.COM) or a file mark (placed by FMARK.COM). Use of RELEASE
  235. with in-memory marks is described above. To use RELEASE with
  236. file marks, call it with the name of the mark file on the command
  237. line:
  238.  
  239.     RELEASE [d:][directory]filename
  240.  
  241. In this case the filename must be specified on the command line,
  242. and only a file mark *exactly* matching the command line will be
  243. released. If the specified mark file is not found, RELEASE will
  244. halt with an error message. When the memory is released, the mark
  245. file is also deleted from disk.
  246.  
  247. There is no direct equivalent of protected marks for FMARK. If
  248. an unnamed RELEASE finds an in-memory mark below a file mark,
  249. the file mark will be released in the process of the unnamed
  250. release. In this case, the mark file will not be deleted from
  251. disk.
  252.  
  253. ----------------------------------------------------------------
  254.  
  255. Version 2.1 of RELEASE fixes a stupid bug in 2.0. This bug lead
  256. to reports of RELEASE printing its status message on the
  257. printer, and to some system crashes. The bug was caused by
  258. writing over the first two bytes of the DOS file handle table at
  259. offset 0018H in the PSP.
  260.  
  261. ----------------------------------------------------------------
  262.  
  263. Version 2.2 of RELEASE adds a few new features. These features
  264. are activated by command line switches. The valid switches are
  265. as follows:
  266.  
  267.   /K    release memory above the specified MARK, but Keep the
  268.         MARK itself in memory. This switch is useful if you plan
  269.         to reinstall the released TSRs later.
  270.  
  271.   /R    Revector the 8259 interrupt controller(s) to powerup
  272.         state. This option is useful for TSRs that patch in to
  273.         the system at a very low level. Examples include network
  274.         operating system shells, multitaskers, etc. Use this
  275.         option with caution; that is, test it at a time when
  276.         no useful work is loaded into memory.
  277.  
  278.   /?    Show a brief help screen and halt.
  279.  
  280. Any of these options are acceptable when preceded by a '-', for
  281. example, -K instead of /K.
  282.  
  283. The /R option now allows the release of DesqView, Windows, and
  284. TaskView from memory. Unfortunately, it does *not* allow the
  285. release of the Novell Netware shell, nor can DoubleDOS be
  286. released even with the /R option. (Both of these hook into DOS at
  287. a level lower than RELEASE can undo.)
  288.  
  289. Version 2.2 of RELEASE also restores a few additional memory
  290. locations from the MARK. It restores 8 bytes at 40:A8
  291. (associated with the EGA) and 16 bytes at 40:F0 (the
  292. interapplications communications area).
  293.  
  294. ----------------------------------------------------------------
  295.  
  296. Version 2.3 of RELEASE adds support for the new WATCH feature of
  297. the TSR Utilities. There will be no apparent difference in
  298. RELEASE's behavior, but behind the scenes, it is updating the
  299. WATCH data area whenever you release TSRs from memory.
  300.  
  301. ----------------------------------------------------------------
  302.  
  303. Version 2.4 of RELEASE slightly changes the way that EMS expanded
  304. memory is managed. We have had a number of reports of EMS clones
  305. in which one of the EMS library functions that we use is not
  306. correctly implemented. Since there is an alternate means of
  307. getting the same information, and apparently the alternate means
  308. is more reliably implemented, we have changed RELEASE (and
  309. MAPMEM). See the source code if you care about the details.
  310.  
  311. We have also added a new RELEASE command line switch, /N, which
  312. causes RELEASE to avoid touching EMS memory at all. Since so few
  313. memory resident programs use expanded memory, this switch will
  314. allow RELEASE to be used for the majority of programs even if a
  315. conflict with the EMS driver occurs.
  316.  
  317. ----------------------------------------------------------------
  318.  
  319. Version 2.6 of RELEASE allows it to work in a system where a
  320. replacement command processor has been installed, in particular
  321. one that is an EXE file.
  322.  
  323.  
  324. C. MAPMEM and WATCH
  325. ================================================================
  326.  
  327. MAPMEM.EXE is used to display the current DOS memory map. It shows
  328. the resident programs, how much memory they use, and what interrupt
  329. vectors each currently controls. MAPMEM also shows information
  330. about expanded memory when such a driver is installed. MAPMEM
  331. writes to the standard output -- thus the output can be printed
  332. or stored to a file by using DOS redirection.
  333.  
  334. MAPMEM shows MARKs and FMARKs so that you can examine them prior
  335. to a RELEASE. A MARK will show the owner name "MARK", and the
  336. mark name (if any) in the command line area. An FMARK will show
  337. "N/A" in the owner column (due to the minimal memory kept by an
  338. FMARK), and the name of the mark file in the command line area.
  339.  
  340. MAPMEM supports the following command line options:
  341.  
  342.      /V     Verbose report.
  343.      /?     Write a brief help screen.
  344.  
  345. MAPMEM accepts either "/" or "-" to delimit the command line
  346. options.
  347.  
  348. On the Verbose report, the "Files" column shows the number of
  349. file handles that each resident block has kept open. Each block
  350. of memory reported by DOS is listed individually in verbose
  351. mode. This is useful in debugging problems, either with the TSR
  352. Utilities themselves, or perhaps with the resident programs that
  353. you are using.
  354.  
  355. By default, each "hooked vector" that MAPMEM reports shows only
  356. the current owner of the vector. Any previous owners now chained
  357. onto the list are not shown. Because of the technique used,
  358. MAPMEM may report some bogus hooked vectors (generally high
  359. numbered ones). If WATCH has been installed, however, MAPMEM
  360. reads the WATCH information area in memory and shows the vectors
  361. for which any TSR gains control. No bogus values should appear
  362. in this case.
  363.  
  364. ----------------------------------------------------------------
  365.  
  366. WATCH.COM is a resident program that keeps track of other memory
  367. resident programs. As a TSR goes resident, WATCH updates a data
  368. area in memory that contains information about what interrupt
  369. vectors were taken over. This information can later be used by
  370. MAPMEM and DISABLE to show more details about interrupts than
  371. normally available.
  372.  
  373. Installation of WATCH.COM is optional. All of the TSR Utilities
  374. except DISABLE can be used whether or not WATCH is installed.
  375.  
  376. If you want to use it, WATCH.COM should be installed as the
  377. first TSR in your AUTOEXEC.BAT file. WATCH uses about 4000 bytes
  378. of memory when it is installed. Most of this memory holds various
  379. information about the TSRs installed in the system -- it includes
  380. two copies of the interrupt vector table, and one data area which
  381. shows what interrupt vectors were taken over by each TSR. This
  382. information is used by DISABLE to deactivate and reactivate TSRs
  383. without removing them from memory.
  384.  
  385.  
  386. D. DISABLE
  387. ================================================================
  388.  
  389. DISABLE is a program new to TSR Utilities version 2.3. With it,
  390. you can disable and reenable specified memory resident programs
  391. without removing them from memory. Its function is analogous to
  392. that performed by REFEREE from Persoft, although DISABLE has
  393. neither a fancy user interface nor an option to work from within
  394. other programs. DISABLE can allow conflicting TSRs to coexist.
  395.  
  396. In order to use DISABLE, you must install WATCH.COM as the first
  397. memory resident program in your system. WATCH keeps the detailed
  398. information about each memory resident program that DISABLE uses
  399. to later control them.
  400.  
  401. Like the other TSR Utilities, DISABLE is operated from the
  402. command line. You specify a single TSR by its name (if you are
  403. running DOS 3.x) or by its address as determined from a MAPMEM
  404. report. If you specify an address, immediately precede the
  405. address with a dollar sign "$" and specify the address in
  406. hexadecimal.
  407.  
  408. The name specified for a TSR is the one reported by MAPMEM in the
  409. "owner" column. If the owner column reports "N/A", then you must
  410. instead specify the address from the "PSP" column.
  411.  
  412. DISABLE accepts the following command line syntax:
  413.  
  414.   DISABLE TSRname|$PSPaddress [Options]
  415.  
  416. Options may be preceded by either / or -. Valid options
  417. are as follows:
  418.  
  419.      /A     reActivate the specified TSR.
  420.      /?     Write a brief help screen.
  421.  
  422. If no option is specified, DISABLE will disable the named TSR.
  423.  
  424. Examples of usage:
  425.   DISABLE SK        {disables SideKick}
  426.   DISABLE SK /A     {reenables SideKick}
  427.   DISABLE $2F2E     {disables the TSR at address 2F2E}
  428.  
  429. MAPMEM will indicate disabled TSRs by displaying the word
  430. "disabled" in the interrupt vector column of the report.
  431.  
  432.  
  433. E. RAMFREE and EATMEM
  434. ================================================================
  435.  
  436. RAMFREE.COM supplies a fast way to determine the amount of free
  437. RAM without going through CHKDSK. Just type RAMFREE and it will
  438. quickly report the free bytes of RAM.
  439.  
  440. EATMEM.COM is useful for program development. When you want to
  441. test software in an environment with a desired amount of
  442. available memory, EATMEM will install itself to use up any
  443. desired amount. The memory used by EATMEM can be freed by using
  444. MARK and RELEASE. Call EATMEM with a single command line
  445. parameter, specifying the (decimal) number of KILOBYTES to eat
  446. up:
  447.  
  448.   EATMEM KiloBytesToEat
  449.  
  450. EATMEM will happily allow you to eat up all available memory,
  451. leading to a system crash when COMMAND.COM cannot be reloaded. Be
  452. sure to calculate how much memory to use before calling EATMEM.
  453.  
  454.  
  455. F. The Story Behind the TSR Utilities
  456. ================================================================
  457.  
  458. These programs should work on any system running PC-DOS or MS-DOS
  459. 2.0 or later. They were developed on a Compaq Deskpro 286 running
  460. Compaq DOS 3.0 and have subsequently been tested on a number of
  461. different systems.
  462.  
  463. Complete source code for the TSR Utilities is available in the
  464. file TSRSRC.ARC. MARK, FMARK, WATCH, RAMFREE and EATMEM are
  465. written in assembly language (MASM or TASM), while DISABLE,
  466. MAPMEM and RELEASE are written in Turbo Pascal version 5. On
  467. CompuServe, TSRSRC is found in the Borland SIG (Go BPROGA) in
  468. data library 2 (LIB 2).
  469.  
  470. These programs are copyrighted, but may be freely distributed for
  471. personal, non-commercial use. You may use them yourself, give
  472. them to your friends or co-workers, or distribute them for a
  473. cost-based fee as part of a user's group or bulletin board
  474. service. If you wish to distribute these programs as part of a
  475. commercial package, please contact us for a license agreement.
  476.  
  477. These programs were originally developed as an exercise in
  478. understanding DOS memory management. We request no donation.
  479. However, we will request $10 to cover our cost and time if you
  480. ask us to ship a disk to you.
  481.  
  482. TurboPower Software is in the business of Turbo Pascal
  483. programming tools for serious developers. If you fall into that
  484. category, please contact us for more information about our
  485. productivity tools.
  486.  
  487. The TSR Utilities were written by Kim Kokkonen, with thanks to
  488. Neil Rubenking for the original idea behind MARK and RELEASE.
  489. Also my thanks to Richard Wilson and Barry Simon at CalTech for
  490. the idea that lead to FMARK, and for much useful correspondence
  491. about the TSR Utilities.
  492.  
  493. We can be reached at:
  494.  
  495.      TurboPower Software
  496.      P.O. Box 66747
  497.      Scotts Valley, CA 95066-0747
  498.      408-438-8608 (voice only, Monday-Friday 9AM-5PM)
  499.      Compuserve: 72457,2131
  500.  
  501. Version 2.6 - 1/15/89
  502.   Corrects a problem with RELEASE that occurs when a replacement
  503.   command processor is installed, and is an EXE file. (Thanks to
  504.   Tom Rawson for providing these changes.)
  505.   Also converts the Pascal programs to Turbo Pascal version 5.
  506.  
  507.   Several programs that were previously COM files are now EXE
  508.   files. If you're converting from a previous version, be sure to
  509.   delete the following COM files before switching over.
  510.      RELEASE.COM
  511.      DISABLE.COM
  512.      MAPMEM.COM
  513.  
  514. The TSR Utilities are Copyright (c) 1986,1987,1989 by Kim Kokkonen.
  515. All Rights Reserved.
  516.